package com.orange.modules.dao;

import java.sql.SQLException;
import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.orange.dbhelp.DbHelper;
import com.orange.modules.entity.AuthItemLevelMap;

@Repository
public class AuthItemLevelMapRepository {

	@Resource(name = "dbHelper")
	private DbHelper dbHelper;
	
	@Autowired
	private AuthItemLevelMapDao authItemLevelMapDao;
	
	/**
	 * 新增自评细则等级
	 * @param ailm
	 * @throws SQLException
	 */
	public void insertItemlevelMap(List<AuthItemLevelMap> ailm) throws SQLException{
		authItemLevelMapDao.save(ailm);
	}
	
	/**
	 * 删除自评等级细则
	 * @param schoolId
	 * @param subject
	 * @throws SQLException 
	 */
	public void deleteItemlevelMap(String itemId,String schoolId,String subject) throws SQLException{
		String sql="DELETE FROM t_auth_item_level_map WHERE item_id=? AND si_id=?";
		if(StringUtils.isNotBlank(subject)){
			sql+=" AND　login_type= '"+subject+"'";
		}
		dbHelper.execute(sql, itemId,schoolId);
	}
	
	
	
}
